// Test library card

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {
    int r, handPos = 0;
    int numPlayer = 2;
    int seed = 1000;
    int k[10] = {adventurer, council_room, feast, gardens, mine
        , remodel, smithy, village, baron, great_hall};
    struct gameState G;
    int maxHandCount = 5;
    int deckCount = 10;
    int player_hand[maxHandCount];
    int handCount = 1;
    
#if (NOISY_TEST == 1)
    printf ("TESTING library card:\n");
#endif
    
#if (NOISY_TEST == 1)
    printf("Test player with card hand count of %d.\n",handCount);
#endif
    memset(&G, 23, sizeof(struct gameState));   // clear the game state
    r = initializeGame(numPlayer, k, seed, &G); // initialize a new game
    G.handCount[0] = handCount;                 // set the number of cards on hand
    
    // Use library card
    handCount -= 1;
    
    // Add 7 cards to hand
    for ( int i = 0; i<7; i++)
    {
        if ( deckCount < 0 || handCount > 7)
            break;
        
        deckCount -= 1;
        handCount += 1;
    }

    printf("Number of cards in deck: %d\n", handCount);
    
    assert( handCount == 7 );
    
    printf("All tests passed!\n");
    
    return 0;
}
